<template>
    <el-dialog
      :title="title"
      :close-on-click-modal="false"
      :visible.sync="visible"
      :before-close="cancel"
      class="JNPF-dialog JNPF-dialog_center"
      lock-scroll
      width="55%"
    >
      <el-row :gutter="20" class="">
        <el-form
          ref="elForm"
          :model="dataForm"
          :rules="rules"
          label-width="120px"
        >
          <el-col :span="12">
            <el-form-item label="危废编号" class="required" prop="FCATNO">
              <el-input
                v-model="dataForm.FCATNO"
                placeholder="请输入"
                clearable
                :disabled="!insertorupdate"
                maxlength="8"
                :style="{ width: '100%' }"
              >
              </el-input>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="危险废物">
              <el-select v-model="dataForm.FPARENTNO" placeholder="请选择">
                <el-option
                  v-for="item in options3"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item class="required" label="危废名称" prop="FCATNAME">
              <el-input
                v-model="dataForm.FCATNAME"
                placeholder="请输入"
                clearable
                :style="{ width: '100%' }"
              >
              </el-input>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="物质形态" prop="FCATNO">
              <el-input
                v-model="dataForm.FCATNO"
                placeholder="请输入"
                clearable
                :style="{ width: '100%' }"
              >
              </el-input>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="危险类型">
              <el-select v-model="dataForm.FCATTYPE" placeholder="请选择">
                <el-option
                  v-for="item in options1"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="危险代码">
              <el-select v-model="dataForm.FCATFLAG" placeholder="请选择">
                <el-option
                  v-for="item in options2"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="24">
            <el-form-item label="主要成分" prop="FCATFLAG">
              <el-input
                v-model="dataForm.FCATFLAG"
                placeholder="请输入"
                clearable
                :style="{ width: '100%' }"
              >
              </el-input>
            </el-form-item>
          </el-col>

          <el-col :span="24">
            <el-form-item label="维修特性" prop="FCATFLAG">
              <el-checkbox v-model="checked1">易燃性</el-checkbox>
              <el-checkbox v-model="checked2">反应性</el-checkbox>
              <el-checkbox v-model="checked3">腐蚀性</el-checkbox>
              <el-checkbox v-model="checked4">毒性</el-checkbox>
              <el-checkbox v-model="checked5">感染性</el-checkbox>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="产生环节" prop="FMEMO">
              <el-input
                v-model="dataForm.FMEMO"
                placeholder="请输入"
                clearable
                :style="{ width: '100%' }"
              >
              </el-input>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="状态">
              <el-radio-group v-model="dataForm.FVISIBLE">
                <el-radio :label="1">有效</el-radio>
                <el-radio :label="0">无效</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>

          <el-col :span="24">
            <el-form-item label="描述" prop="FCATLABEL">
              <el-input
                v-model="dataForm.FCATLABEL"
                placeholder="请输入"
                clearable
                :style="{ width: '100%' }"
              >
              </el-input>
            </el-form-item>
          </el-col>

        </el-form>
      </el-row>
      <span slot="footer" class="dialog-footer">
        <el-button @click="cancel">取 消</el-button>
        <el-button  v-if="insertorupdate" type="primary" v-loading="loading">确 定</el-button>
        <el-button v-else type="primary"  v-loading="loading">修 改</el-button>
      </span>
    </el-dialog>
  </template>
  <script>
  import jnpf from "@/utils/jnpf"
  export default {
    props: {
      parelist: {
        type: Array,
        default: []
      },
    },
    data() {
      return {
          checked1:true,
          checked2:true,
          checked3:true,
          checked4:true,
          checked5:true,
          title:"新增",
          dataForm:{
            FCATTYPE:"化学废物",
            FCATNAME:"化学药品原药制造",
            FCATNO:"271-001-02",
            FCATFLAG:"化学药品原料药生产过程中的蒸馏及反应残渣",
            FCATLABEL:"一般固废",
            FMEMO:"",
            FVISIBLE:1,
            FOPERATOR: "system",
            FUPDDATE: "2011-02-16T02:57:02.000+00:00"
          },
          rules: {
            FCATNO: [
                  { required: true, message: '请输入危废类别编号', trigger: 'blur' },
              ],
              FCATNAME: [
                  { required: true, message: '请输入行业来源', trigger: 'blur' },
              ],
          },
        fvisiblelist:[
          {id:"1",fullName:"是"},
          {id:"2",fullName:"否"},
        ],

        //所属教学楼选择数据
        options1: [{
          value: '20E01',
          label: '医疗废物'
        }, {
          value: '20E02',
          label: '医药废物'
        }, {
          value: '20N03',
          label: '废有机溶剂与含有机溶剂废物'
        }, {
          value: '20E04',
          label: '多氯（溴）联苯类废物'
        }],

        options2: [{
          value: '1',
          label: '卫生'
        }, {
          value: '2',
          label: '化学药品原药制造'
        }, {
          value: '3',
          label: '生物、生化制品的制造'
        }],

        options3: [{
          value: '1',
          label: '危险废物'
        }, {
          value: '2',
          label: '一般固废'
        }],

        loading:false,
        visible:false,
        insertorupdate:true
      };
    },
    created() {
    },
    mounted() {},
    methods: {
      //
      init(id){
        this.dataForm.FCATNO= id || ''
          if(this.dataForm.FCATNO)
          {
              this.title="修改"
             this.insertorupdate=false;
          }
          else
          {
            this.insertorupdate=true;
              this.title="新增";
          }
          this.visible=true;
      },
      //
      cancel(){
          this.$refs.elForm.resetFields();
          this.visible=false;
      },
    },
  };
  </script>
  
  
  
  
  